home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-21 | 3.9 KB | 113 lines | [TEXT/MPS ] |
- EJECT
- ; LEGALESE: © 1989, 1990 Apple Computer, Inc. All rights reserved.
- ;
- ; PROJECT: System 7.0 Installer Script
- ;
- ; WHAT: EtherSniffer - a routine which looks to see if an EtherTalk card is installed
- ;
- ; AUTHOR: Bruce Jones
- ;
- ; PURPOSE: This is an 'infn' code segment which can be called by the Installer to
- ; determine whether or not an Apple EtherTalk card is installed. This code
- ; resource will be included in an Installer script.
- ;
- ; HISTORY:
- ; 4/21/90 BKJ Clean up for Developer's Conference
- ; 11/17/89 BKJ Dove Computer uses DrSwApple but is not compatible with our drivers.
- ; This forces us to use the DrHw field of the type as well. Sigh.
- ; 11/13/89 BKJ Created
- ;
- ; BUILD:
- ; asm "Bruce:MPW:Interfaces:AIncludes::astructmacs:"ProgStrucMacs.a -o Dev:Null
- ; asm "Bruce:MPW:Interfaces:AIncludes::astructmacs:"FlowCtlMacs.a -o Dev:Null
- ; asm EtherSniffer.a -o EtherSniffer.a.o
- ; Link -ra =32 -rt infn=1001 -rn EtherSniffer.a.o -t rsrc -c RSED -o EtherSniffer.rsrc
- ; Delete EtherSniffer.a.o
-
-
- LOAD 'ProgStrucMacs.d'
- LOAD 'FlowCtlMacs.d'
- INCLUDE 'Traps.a'
- INCLUDE 'SlotEqu.a'
-
- ; a few symbols
- false EQU 0
- true EQU 1
- DEBUG EQU true ;
-
- ; Equates we need to supplement SlotEqu.a
- CatNetwork EQU $04 ; Network category of devices
- TypEtherNet EQU $01 ; within catNetwork, the type for EtherNet cards
- DrSwApple EQU $00 ; The Apple Driver Interface
- DrHw3Com EQU $01 ; The Apple Hardware
-
-
-
- ; FUNCTION EtherSniffer(vRefNum: INTEGER; sysFolderDirID: LONGINT): BOOLEAN;
- ;
- ; This routine acts like a Pascal routine (may destroy D0-D2/A0-A1) and returns a boolean.
- ; We ignore the two parameters which are passed in.
- ; This routine uses the Slot Manager to determine if we have an EtherTalk card installed.
- ; We simply ask the Slot manager if a card with spCategory = catNetwork, spCType = typEtherNet
- ; and DrSWType = DrSwApple exists. <11/17/89> We need to check DrHw field as well, see history.
- ;
-
-
- EXPORT FUNCTION EtherSniffer(vRefNum:W, sysFolderDirID:L):B
-
- VAR slotMgrPB: SpBlock
-
- BEGIN
- GOTO#.S @Sniffer
- ALIGN
- DC.L ('infn') ; This looks good in the debugger & resedit!!
- DC.W 0
- DC.W 0
- DC.B 'EtherSniffer (is an EtherTalk card installed?)'
- ALIGN
-
- @Sniffer
- CLR.W EtherSniffer(FP) ; Assume we'll return false
-
- ; Check to see if the slot manager exists - if it doesn't we can safely assume no card!
- MOVE.W #$A06E,d0 ; Slot Manager trap number
- _GetTrapAddress NEWOS
- MOVE.W a0,a1 ; save this so we can compare it to unimplemented
-
- MOVE.W #$A89F,d0 ; Unimplemented trap number
- _GetTrapAddress NEWOS
-
- GOTO#.S IF# a0 EQ.W a1 THEN @Done ; If trap is not implemented then assume we can't have cards
-
- ;----------------------------------------
-
- ; We know the slot manager exists - ask it if the an ether card is installed
- LEA slotMgrPB(FP),a0 ; point to param block
- WITH SpBlock
- MOVE.B #sFirstSlot,spSlot(a0) ; start looking in the first slot
- CLR.B spID(a0) ; Just look at the Board sResource List
- CLR.B spExtDev(a0) ; we don't care about the device id
- CLR.B spTBMask(a0) ; Check all fields
- MOVE.W #catNetwork,spCategory(a0) ; Looking for card whose category is network
- MOVE.W #typEtherNet,spCType(a0) ; and whose type is EtherNet
- MOVE.W #drSwApple,spDrvrSW(a0) ; and supports the Apple API
- MOVE.W #DrHw3Com,spDrvrHW(a0) ; and it's Apple Hardware
- CLR.B spHWDev(a0) ; we don't care about any external devices
- ENDWITH
- _SNextTypesRsrc ; Go look for the sResource -> the card
- BNZ.S @Done ; If we get an error back, assume no such card
-
- ;----------------------------------------
-
- @CardFound ; We know we have the card
- ADDQ.B #true,EtherSniffer(FP) ; We had a default return of False, make it True
-
- ;----------------------------------------
-
- @Done
-
- RETURN
- ENDP
-
-
- END